//
//  CellOfCollectionViewOfHot_city.m
//  FreeTravel
//
//  Created by 徐康 on 16/9/6.
//  Copyright © 2016年 KX. All rights reserved.
#import "Masonry.h"
#import "UIImageView+WebCache.h"
#import "CellOfCollectionViewOfHot_city.h"
@interface CellOfCollectionViewOfHot_city ()
@property (nonatomic, strong) UILabel *labelOfCnname;
@property (nonatomic, strong) UILabel *labelOfEnname;
@property (nonatomic, strong) UIImageView *imageViewOfPhoto;
@end
@implementation CellOfCollectionViewOfHot_city
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.labelOfCnname = [[UILabel alloc]init];
        self.labelOfEnname = [[UILabel alloc]init];
        self.imageViewOfPhoto = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageViewOfPhoto];
        [self.contentView addSubview:self.labelOfEnname];
        [self.contentView addSubview:self.labelOfCnname];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    [self.imageViewOfPhoto mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.equalTo(self.contentView);
        
    }];
    [self.labelOfCnname mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.height.mas_offset(20);
        make.bottom.equalTo(self.contentView.mas_centerY);
    }];
    self.labelOfCnname.textAlignment = NSTextAlignmentCenter;
    self.labelOfCnname.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.f];
    self.labelOfCnname.textColor = [UIColor whiteColor];
    [self.labelOfEnname mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.height.mas_offset(20);
        make.top.equalTo(self.contentView.mas_centerY);
    }];
    self.labelOfEnname.textColor = [UIColor whiteColor];
    self.labelOfEnname.font = [UIFont systemFontOfSize:12];
    self.labelOfEnname.textAlignment = NSTextAlignmentCenter;
}
- (void)setModel:(ModelOfCountryHot_city *)model{
    _model = model;
    self.labelOfCnname.text = self.model.cnname;
    self.labelOfEnname.text = self.model.enname;
    [self.imageViewOfPhoto sd_setImageWithURL:[NSURL URLWithString:self.model.photo]];
}
@end
